<template>
	<view>
		<!-- 顶部背景 -->
		<view class="top_bg_img">
			<image src="http://qiniu.suboshimuying.cn/static/merchant/logoBg.png" mode=""></image>
		</view>
		<view class="big_box">
			<!-- 导航栏 -->
			<u-navbar leftText=" " title=" " :safeAreaInsetTop="true" :placeholder="true" bgColor="transparent">
				<view class="u-nav-slot" slot="left">
				</view>
			</u-navbar>
			<!-- 顶部 -->
			<view class="top_box flex">
				<view class="left_text">
					<view class="left_title">Hello! 欢迎商家</view>
					<view class="left_desc">请登录苏博士母婴服务平台</view>
				</view>
				<image src="http://qiniu.suboshimuying.cn/static/merchant/logo01.png" mode="" class="right_img"></image>
			</view>
			<!-- 账号密码 -->
			<view class="input_box">
				<view class="item_box flexA">
					<image src="http://qiniu.suboshimuying.cn/static/merchant/account.png" mode="" class="label"></image>
					<input type="text" placeholder="请输入您的账号" v-model="form.username" style="margin-left: 0;">
				</view>
				<view class="item_box flexA">
					<image src="http://qiniu.suboshimuying.cn/static/merchant/pwd.png" mode=""></image>
					<input type="password" placeholder="请输入您的密码" v-model="form.password">
				</view>
			</view>
			<view class="login_box flexC" @click="merchLogin">登录</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					username: "",
					password: ""
				}
			};
		},
		methods: {
			async merchLogin() {
				if (this.form.username && this.form.password) {
					let {
						code,
						data,
						msg
					} = await this.$api.merchLogin(this.form)
					this.$u.toast(msg)
					if (code === 1) {
						setTimeout(() => {
							uni.reLaunch({
								url: '/subPages/merchant/merchant'
							})
						}, 1500)
					}
				} else {
					uni.$u.toast('请补全账号或密码')
				}

			}
		}
	}
</script>

<style lang="scss">
	.top_bg_img {
		position: relative;
		top: 0;

		image {
			width: 750rpx;
			height: 750rpx;
			opacity: 1;
		}
	}

	.big_box {
		position: absolute;
		top: 0;
		left: 32rpx;
	}

	.label {
		width: 52rpx !important;
		height: 52rpx !important;
		margin-top: 10rpx !important;
	}

	.top_box {
		margin: 50rpx auto 0;
		width: 702rpx;

		.left_text {
			margin-right: 68rpx;
			margin-top: 104rpx;

			.left_title {
				color: rgba(59, 55, 88, 1);
				font-size: 48rpx;
				font-weight: 600W;
			}

			.left_desc {
				color: rgba(59, 55, 88, 1);
				font-size: 28rpx;
				font-weight: 600W;
			}
		}

		.right_img {
			width: 270rpx;
			height: 294rpx;
			opacity: 1;
		}
	}

	.input_box {
		padding: 60rpx 32rpx;
		box-sizing: border-box;
		border-radius: 32rpx;
		width: 686rpx;
		height: 336rpx;
		opacity: 1;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0 16rpx 36rpx 0 rgba(235, 219, 254, 0.4);

		.item_box {
			margin-bottom: 40rpx;
			padding: 24rpx 32rpx;
			box-sizing: border-box;
			width: 622rpx;
			height: 88rpx;
			border-radius: 16rpx;
			opacity: 1;
			background: rgba(248, 249, 254, 1);

			image {
				width: 42rpx;
				height: 42rpx;
				opacity: 1;
			}

			input {
				margin-left: 12rpx;
			}
		}
	}

	.login_box {
		margin: 200rpx auto 0;
		width: 686rpx;
		height: 88rpx;
		border-radius: 600rpx;
		opacity: 1;
		background: linear-gradient(131.2deg, rgba(179, 142, 255, 1) 0%, rgba(130, 111, 255, 1) 100%);
		color: rgba(255, 255, 255, 1);
		font-size: 32rpx;
		font-weight: 700;
	}
</style>
